home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Inne
/
Gry
/
Carnage_Contest
/
scripts
/
CC Original
/
weapons
/
Vertical Laser.lua
< prev
next >
Wrap
Text File
|
2010-03-16
|
3KB
|
90 lines
--------------------------------------------------------------------------------
-- Weapon Vertical Laser + Projectile Laser
-- Original Carnage Contest Weapon
-- Script by DC, August 2009, www.UnrealSoftware.de
--------------------------------------------------------------------------------
-- Setup Tables
if cc==nil then cc={} end
cc.vlaser={}
cc.vlaser.laser={}
-- Load & Prepare Ressources
cc.vlaser.gfx_wpn=loadgfx("weapons/vlaser.bmp") -- Weapon Image
setmidhandle(cc.vlaser.gfx_wpn)
cc.vlaser.gfx_laser=loadgfx("weapons/laserbeam.bmp") -- Laser Beam
setmidhandle(cc.vlaser.gfx_laser)
cc.vlaser.sfx_attack=loadsfx("superlaser.ogg") -- Attack Sound
--------------------------------------------------------------------------------
-- Weapon: Vertical Laser
--------------------------------------------------------------------------------
cc.vlaser.id=addweapon("cc.vlaser","Vertical Laser",cc.vlaser.gfx_wpn,0,3) -- Add Weapon (0 uses, first in round 3)
function cc.vlaser.draw() -- Draw
-- HUD Positioning
if weapon_shots==0 then
hudpositioning(pos_invisible)
end
end
function cc.vlaser.attack(attack) -- Attack
if (weapon_shots<=0) and (weapon_position==1) then
-- No more weapon switching!
useweapon(0)
weapon_shots=weapon_shots+1
-- Destroy Terrain
terrainrect(weapon_x-5,0,10,getmapheight(),0x00000000)
-- Damage Players
players=playertable()
for i=1,#players,1 do
if getplayerhealth(players[i])>0 then
if getplayerx(players[i])+7>=weapon_x-5 and getplayerx(players[i])-7<=weapon_x+5 then
playerdamage(players[i],50)
end
end
end
-- FX
playsound(cc.vlaser.sfx_attack)
particle(p_muzzle,weapon_x,weapon_y)
particlecolor(255,0,0)
particlefadealpha(0.005)
particlesize(1,10)
particlerotation(0)
-- Laser
id=createprojectile(cc.vlaser.laser.id)
projectiles[id]={}
projectiles[id].timer=30
projectiles[id].x=weapon_x
projectiles[id].y=weapon_y
-- End Turn
endturn()
end
end
--------------------------------------------------------------------------------
-- Projectile: Laser
--------------------------------------------------------------------------------
cc.vlaser.laser.id=addprojectile("cc.vlaser.laser") -- Add Projectile
function cc.vlaser.laser.draw(id) -- Draw
setblend(blend_light)
setcolor(255,0,0)
setalpha(projectiles[id].timer/30.0)
setrotation(0)
setscale(1,getmapwidth()/10.0)
drawimage(cc.vlaser.gfx_laser,projectiles[id].x,getmapheight()/2.0)
end
function cc.vlaser.laser.update(id) -- Update
-- Timer
projectiles[id].timer=projectiles[id].timer-1
if projectiles[id].timer<=0 then
-- Free projectile
freeprojectile(id)
end
-- Scroll to projectile
scroll(projectiles[id].x,projectiles[id].y)
end